﻿using System;
using System.Collections.Generic;
using JTLeigh.Commerce.Spencer.Features.ProductFeedback.Business.Caches;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using ProductFeedbackE = JTLeigh.Commerce.Spencer.Features.ProductFeedback.Common.Entities.ProductFeedback;

namespace JTLeigh.Commerce.Spencer.Features.ProductFeedback.Business.UnitTests.Caches
{

	/// <summary>
	/// Unit tests for the <see cref="NullProductFeedbackCache"/> class.
	/// </summary>
	[TestClass]
	public class NullProductFeedbackCacheFixture
	{

		#region Fields

		private static Guid TestTenantId = Guid.NewGuid();
        private const string TestCatalogId = "BaseCatalog";
        private const string TestProductId = "123";

		#endregion // Fields

		#region Methods

		#region ProductFeedback

		/// <summary>
		/// Ensures <see cref="NullProductFeedbackCache.GetProductFeedback"/> always returns <see langword="null"/> 
		/// regardless of whether feedback have been added to the cache via <see cref="NullProductFeedbackCache.SetProductFeedback"/>.
		/// </summary>
		[TestMethod]
		public void TestGetSetProductFeedback()
		{
			NullProductFeedbackCache cache;
			Dictionary<Guid, ProductFeedbackE> feedback;

			cache = new NullProductFeedbackCache();
			Assert.IsNull(cache.GetProductFeedback(TestTenantId, TestCatalogId, TestProductId));

			feedback = new Dictionary<Guid, ProductFeedbackE>();
			feedback.Add(Guid.NewGuid(), new ProductFeedbackE());
			feedback.Add(Guid.NewGuid(), new ProductFeedbackE());
			feedback.Add(Guid.NewGuid(), new ProductFeedbackE());
			cache.SetProductFeedback(TestTenantId, TestCatalogId, TestProductId, feedback);
			Assert.IsNull(cache.GetProductFeedback(TestTenantId, TestCatalogId, TestProductId));
		}

		#endregion // ProductFeedback

		#endregion // Methods

	}

}
